<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        .weatcher{
            font-size: 32px;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <div id="test"></div>
    <script src="./js/react.development.js" crossorigin></script> 
    <script src="./js/react-dom.development.js" crossorigin></script>
    <script src="./js/babel.min.js"></script>
    <script type="text/babel">
        class Weather extends React.Component{
            constructor(props){
                super(props)
            }
            
            state = {isHot: false,wind:'微风'}

            render(){
                const { isHot,wind } = this.state
                return (
                    <div onClick={this.changeWeather} className="weatcher">今天天气很{isHot ? '炎热' : '凉爽'},{wind}</div>
                )
            }
            changeWeather = () => {
                this.setState({
                    isHot: !this.state.isHot
                })
            }
        }

        ReactDOM.render(<Weather/>,document.getElementById('test'))
    </script>
</body>
</html>